<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
	<base href="http://test.youxiduo.com/iweb/shixin_6/" />
	<!--<base href="http://resource.youxiduo.com/special/shihou/promoter/3233/" />-->
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name = "format-detection" content = "telephone=no">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<meta name="viewport"  content="width=device-width,user-scalable=no">
	<title>排名奖励翻3番最高一小时300元</title>
	<meta name="keywords" content="游戏多">
	<meta name="description" content="游戏多">
	<link rel="stylesheet" href="static/css/base.css" />
	<link rel="stylesheet" href="static/css/reset.css" />
	<link rel="stylesheet" href="static/css/jquery-weui.css" />
	<link rel="stylesheet" href="static/css/style.css" />
	<script src="static/js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="static/js/util.js" ></script>
	<script type="text/javascript" src="static/js/config.js" ></script>
	<script src="static/js/zepto.min.js"></script>
	<script src="static/js/jquery-weui.js"></script>
	

<script language="JavaScript">
	var util;
	var config;
	var baseUrl;
	var baseUrlWage;
$(function()
{	
	util = new Util();
	config = new Config();
	baseUrl = config.baseUrl;
	baseUrlWage = config.baseUrlWage;
	
	jQuery.support.cors = true;
	
	var time = 3;
	$(".share").click(function()
	{
		if(from_user_id=="0")
		{
			$(".pop").fadeIn(200);
			setTimeout('$(".pop").hide();window.location.href="shihoutv://route?jump_type=120";', time*1000);
		}
		else
		{
			var web_share = {
				"qq": {
					"url": share_url,
					"img": share_icon,
					"title": share_title,
					"subtitle": share_desc
				},
				"wx_person": {
					"url": share_url,
					"img": share_icon,
					"title": share_title,
					"subtitle": share_desc
				},
				"wx_group": {
					"url": share_url,
					"img": share_icon,
					"title": share_title,
					"subtitle": share_desc
				},
				"wb": {
					"url": share_url,
					"img": share_icon,
					"title": share_title,
					"subtitle": share_desc
				}
			};
		
			if (typeof(window.lion) != "undefined" && typeof(window.lion.web_share) == 'function')
			{
				window.lion.web_share(JSON.stringify(web_share));
			}	
		}
	});
	
	$('.loginBtn').click(function(){
		if(from_user_id=="0"){
			$(".pop").fadeIn(200);
			setTimeout('$(".pop").hide();window.location.href="shihoutv://route?jump_type=120";', time*1000);
		}
	});
	
	//展开隐藏
	$(".box").each(function()
	{
		var btnShow = $(this).find(".btnShow");
		var btnHide = $(this).find(".btnHide");
		var rule    = $(this).find(".rule");
		btnShow.bind("click",function()
		{
			rule.css('display','block');
			btnShow.css('display','none');
			btnHide.css('display','block');
		});
		btnHide.bind("click",function()
		{
			///rule.slideUp();
			rule.css('display','none');
			btnHide.css('display','none');
			btnShow.css('display','block');
		});
	});
	
	$("#btn_sign").click(function(){
		if("1"==signed){
			return;
		}
		if(from_user_id=="0"){
			$("#login_error").fadeIn(200);
			setTimeout('$("#login_error").hide()', time*1000);
		}else{
			signUp(); //报名操作
		}
	});
	
	//点击【立即报名】
	$('.btnBm').live("click", function(){
		signUp();
	});
	
});


	//报名操作
	function signUp(){
		$.ajax({ 
			url: baseUrl+"/ajax_sign_up",
			type: 'GET',
			async: false,
			dataType: "jsonp",
			jsonp: "callback", //服务端用于接收callback调用的function名的参数(请使用callback或jsonp)
			jsonpCallback: "success_jsonpCallback", //callback的function名称
			data: {'from_user_id':from_user_id,"share_conf_id":share_conf_id, "deviceId":deviceId},
			success: function (data)
			{
				if(0==data.errorCode){//报名成功
					$("#sign_up_success").fadeIn(200);		
					setTimeout('$("#sign_up_success").hide()', 1500);
					setTimeout('location.href=location.href', 1500);
					//将【立即报名】替换为【个人中心】
					//$(".btnBm").hide();
					//$(".btnOver").css("display","block");
				}
				else{//报名失败
					$("#sign_up_error").html(data.errorDescription);
					$("#sign_up_error").fadeIn(200);
					setTimeout('$("#sign_up_error").hide()', 3000);
				}
			}
		});
	}

	//获取用户信息
	function getUserInfo(){
		console.log('getUserInfo');
		$.ajax({
			url: baseUrl+'/UserInfoAjaxApiServlet',
			type: 'GET',
			async: false,
			dataType: "jsonp",
			jsonp: "callback", //服务端用于接收callback调用的function名的参数(请使用callback或jsonp)
			jsonpCallback: "success_jsonpCallback", //callback的function名称
			data: {'userId':from_user_id,"plantId":plan_Id, "activityId":share_conf_id},
			success: function (res)
			{
				console.log(res);
				if(res.errorCode == '0'){
					var data = res.result;
					var kaiboTimeStr = data.kaiboTimeStr;
					var income = data.income;
					if(typeof(data.kaiboTimeStr) == "undefined" && kaiboTimeStr.length < 1)
						kaiboTimeStr = "无";
					if(typeof(data.income) == "undefined" && income.length < 1)
						income = "0";
				    var baoming = '<a href="javascript:void(0)" class="btnBm btnZj" title="立即报名"><img src="static/img/btnBm.png" /></a>';
				    if("1" == signed){//已报名
						baoming = '<a href="'+ baseUrl+'/task/user_center?uid='+from_user_id+'&plantId='+plan_Id +'&activityId='+share_conf_id+'" title="我的收益"><span class="btnOver btnZj" style="display:none1;" title="我的收益"><img src="static/img/btnSy.png" /></span></a>';
					}

				    var html = '<div class="userInfo">'+
					            	'<span class="userHead"><img src="'+data.icon+'" /></span>'+
					                '<span class="userName">'+data.nickName+'</span>'+
					                '<span class="userTime">时长：<i>'+kaiboTimeStr+'</i></span>'+
					                '<span class="userMoney">总收益：<i>'+income+'元</i></span>'+
					                baoming+
					            '</div>';
			    	$(".state").prepend(html);
				}
			},
			error:function(res){
				console.log(JSON.stringify(res));
			}
		});
		
	}
	function success_jsonpCallback(){
	}
	
	//获取用户排名
	function getUserRank(){
		var url = baseUrlWage+'/UserRankAndExtra';
		var dateStr = $('#time').val().split(" ")[0];
		var data = {"activityId":share_conf_id, "userId":from_user_id, "startDate":dateStr, "endDate":dateStr};
		requestRemoteDate(url, data, function(res){
			console.log(JSON.stringify(res));
			if(res.errorCode == "0"){
				var result = res.result;
				var rank = result.rank;
				var wage = result.shiya;
				var viewStatus = result.viewStatus;
				var viewTotal = result.viewTotal;
				
				if(parseInt(rank) > parseInt(viewTotal)){
					rank = "0";
					wage = "0";
				}
				if(rank == "0")
					rank = "无";
				else
					rank += "名";
				if(wage == "0")
					wage = "无";
				else
					wage = (parseInt(wage)/20) + "元"
				$('#rank').html(rank);
				$('#wage').html(wage);
				if(viewStatus == "1"){
					$('.nav').show();
				}
			}
		});
	}
	
	function requestRemoteDate(url, data, callback){
		console.log("url --> " + url);
		console.log("data --> " + JSON.stringify(data))
		$.ajax({
	        url: url,
	        type: 'GET',
	        dataType: "json",
	        data: data,
	        success: callback,
	        error: function (data,t,e) {
	        	console.log("data --> " + JSON.stringify(data));
	        	console.log("data --> " + JSON.stringify(e));
	        	var status = data.status;
	        	console.log(url + "获取数据失败!");
	        }
	    });
	}

	
	//获取当天日期
	function getNowFormatDate(year, month, day) {
		year = year || 0;
		month = month || 0;
		day = day || 0;
		var date = new Date();
		date.setFullYear(date.getFullYear() + year);
		date.setMonth(date.getMonth() + month);
		date.setDate(date.getDate()+day);//获取day天后的日期 
		var seperator1 = "-";
		var seperator2 = ":";
		var month = date.getMonth() + 1;
		var strDate = date.getDate();
		if(month >= 1 && month <= 9) {
			month = "0" + month;
		}
		if(strDate >= 0 && strDate <= 9) {
			strDate = "0" + strDate;
		}
		var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate ;//+ " " + date.getHours() + seperator2 + date.getMinutes();
		return currentdate;
	}

</script>
</head>
<body>
	<div class="wrap"> 
    	<header class="header">
        	<img src="static/img/top1.jpg" />
            <a class="share shareT shareIT"><img src="static/img/share.png" /></a>
        </header>
        <div class="state">
            <div class="nav" style="display: none;">
            	<p class="navSj g-auto">时间:
                	 <input class="weui_input" id="time" type="text" value="">
                     <input type="text" value="" class="dispaly_value"/>
                <span></span></p>
                <p class="navPm">排名:<i id="rank">无</i></p>
                <p class="navJl">奖励:<i id="wage">无</i></p>
            </div>
            
        </div>
        <div class="noLogin" ><img src="static/img/noLogin.png">
            <a class="loginBtn">
                <img src="static/img/loginBtn.png">
            </a>
        </div>
        <section>
        	
        	<!-- 时薪延续 -->
            <div class="box">
                <img src="static/img/top2y.jpg"/>
                <div class="title">
                    <p>新主播担心自己上不了排名？没有奖励？NO！新人只要来开播，马上有福利！
                    	<em class="yellow">播1小时=3元，实时到账！6月1日起</em>
                    </p>
                    <a href="javascript:void();" id="activity_detail" class="tx qd"><img src="static/img/qdxq.png"/></a>
                </div>
            </div>
        	
        	<div class="box">
            	<div class="header">
                	<img src="static/img/top3.jpg"/>
                </div>
                <div class="title">
                    <dl>
                        <dt>温馨提示：</dt>
                        <dd><em>1.</em> 排名奖励每日结算，次日即可提现。播一小时最高赚300元，轻轻松松月入破万。</dd>
                        <dd><em>2.</em>大幅度提升优质主播收益，新排名奖励最高增长3倍，用心开播的主播都会很容易进入前2000名，从而获得每日排行奖励。(取消原2元/小时的基础时薪，告别通过恶意挂机赚时薪的行为)</dd>
                        <dd><em>3.</em>稳定、持续的开播将助你处于排名前列！收益每天上限3小时，但直播时间越长，有机会获得更多的人气和关注，从而提高你的排名。</dd>
                    </dl>
                    <a href="http://m.shihou.tv/get_income_tos" class="tx"><img src="static/img/tx.png"/></a>
                </div>
            	<div class="rule">
                	<dl>
                    	<dt>规则说明：</dt>
                        <dd><em>1.</em>每日排行依据：直播时长、人气、收益、弹幕数等；</dd>
                        <dd><em>2.</em>主播每天中午12点可在活动页面查看自己昨日的排名和奖励；</dd>
                        <dd><em>3.</em>排名奖励自动发放至主播账户“我的收益”中，可直接提现；</dd>
                        <dd><em>4.</em>参与对象：全平台用户（签约、公会主播除外），已签约主播暂不参与排行奖励。</dd>
                        <dd><em>5.</em>挂机、直播非法内容惩罚：一旦发现永久停封主播账号，收益清零，并取消提现资格；</dd>
                    </dl>
                </div>
                <a class="btnShow btn">活动细则<em></em></a>
                <a class="btnHide btn">收起<em></em></a>
            </div>
            
           <!--如何认证-->
            <div class="box">
                <img src="static/img/top4.jpg"/>
                <div class="title titleRZ">
                	<p>直播数据表现突出的主播还有机会申请认证哦~</p>
                    <p>认证主播可享多项福利资源：</p>
                    <p>高额底薪签约！</p>
                    <p>狮吼平台推荐资源！</p>
                    <p>多项活动&赛事机会！</p>
                    <a href="http://m.shihou.tv/event_share/3257" class="rzBtn"><img src="static/img/rz.png"/></a>
                </div>
            </div>

            <!--推荐有礼-->
            <div class="box">
                <img src="static/img/top5.jpg"/>
                <div class="title titleRZ">
                    <p>每推荐1名好友开播，即可获得40狮牙；</p>
                    <p>好友活动期间内累计直播时长到达50小时，推荐人可额外获得400狮牙；</p>
                    <p> 这么好玩又好赚的活动，赶紧分享给小伙伴一起来参加吧!</p>
                    <a class="share"><img src="static/img/fx.png"/></a>
                </div>
                <div class="rule">
                    <dl>
                        <dt>推荐说明：</dt>
                        <dd><em>1.</em>推荐好友首次开播满10分钟，即可获得40狮牙，奖励上
                            不封顶，推荐越多，奖励越多；</dd>
                        <dd><em>2.</em>推荐奖励直接发送至账户中，可在任意直播间送礼使用。</dd>
                    </dl>
                </div>
                <a class="btnShow btn">活动细则<em></em></a>
                <a class="btnHide btn">收起<em></em></a>
            </div>
        </section>
        <footer>本活动最终解释权归狮吼直播平台所有，与苹果公司无关</footer>
    </div>
    
    <!-- 登录 -->
	<div class="pop">请登录后再来参加活动吧~</div>
    <div id="sign_up_success" class="pop">报名成功</div>
	<div id="sign_up_error" class="pop">报名失败,请重试</div>
	<div id="login_error" class="pop">请登录后，再点击分享</div>
</body>
</html>
<script>
	var share_icon="http://resource.youxiduo.com/special/shihou/promoter/46/static/img/wzry.png";
	var share_title="王者荣耀玩家专属福利";
	var share_desc="立领200元现金！分享再送30元，还不快来！";
	var plan_Id="4PLwi6yLVak6";
	var share_conf_id="41";
	var signed="1";
	var share_open="1";
	var from_user_id="0";//244269
	var share_url="http://m.shihou.tv/event_share/41?type=1&page=1&from_user_id=244272&share_config_id=41";
</script>
<script>
	$(function(){
		$('.dispaly_value').val(getNowFormatDate(0, 0, -1));
		$("#time").val(getNowFormatDate(0, 0, -1) + " 00:00");
		//日历
		$("#time").datetimePicker({
			min: "2017-04-01",
			max: "2017-12-31 23:59",
			//defaultDate: $.datepicker.parseDate("d m", day+" "+month)
		});
		
		if(from_user_id == 0 || from_user_id == '0'){//未登录
			$('.noLogin').show();
		}else{//已登录
			$('.noLogin').hide();
			getUserInfo();
			getUserRank();
		}
		
		//选择好时间后点击【确定】按钮
		$('.close-picker').live("click", function(){
			getUserRank();
		});
		
		//活动详情页面添加链接
		console.log(config.activity_3236);
		$('#activity_detail').attr("href", config.activity_3236);
	});
</script>
